<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<div class="t_bar">${param.title3 }</div>
<c:set var="statYear"><x:out select="$xmlData/data/proposal/stat_year" /></c:set>
<table  id="milestone_edit" border="0" cellspacing="0" cellpadding="0" class=" t_css" >
		<thead>
			<tr>
                <th width="5%" >序号</th>
				<th width="16%">企业名称</th>
				<th width="16%">法人代表</th>
				<th width="16%">联系电话</th>
				<th width="16%">传真</th>
				<th width="16%">入驻时间</th>
				<th width="16%">注册地址</th>
				
			</tr>
		</thead>
		<tbody id="tab">
	
			<c:set value="0" var="index" scope="page" />
			<x:forEach select="$xmlData/data/milestones/milestone" var="milestone">
				<c:choose>
					<c:when test="${index<10}">
						<c:set value="0" var="flag" scope="page" />
					</c:when>
					<c:otherwise>
						<c:set value="" var="flag" scope="page" />
					</c:otherwise>
				</c:choose>
				<tr>
				<td align="center" style="display: none;">
				
						<input type="radio" name="selMilestone_edit"/> 
						
						<input type="hidden" name="milestones/milestone[${flag}${index}]/equipments" value="<x:out select="$milestone/equipments" />" label="xml"/>
						
				
						<input type="hidden" name="milestones/milestone[${flag}${index}]/hold_birthday" value="<x:out select="$milestone/hold_birthday" />"/>
						
						<input type="hidden" name="milestones/milestone[${flag}${index}]/registered_capital_hatched" value="<x:out select="$milestone/registered_capital_hatched" />"/>
						<input type="hidden" name="milestones/milestone[${flag}${index}]/legal_code" value="<x:out select="$milestone/legal_code" />"/>
						
						<input name="milestones/milestone[${flag}${index}]/c_name" value="<x:out select="$milestone/c_name" />"/>
						<input type="hidden" name="milestones/milestone[${flag}${index}]/contacts_phone_hatched" value="<x:out select="$milestone/contacts_phone_hatched" />"/>
						<input type="hidden" name="milestones/milestone[${flag}${index}]/contacts_email_c_name" value="<x:out select="$milestone/contacts_email_c_name" />"/>
						
						<input type="hidden" name="milestones/milestone[${flag}${index}]/contacts_postcode_hatched" value="<x:out select="$milestone/contacts_postcode_hatched" />"/>
						<input type="hidden" name="milestones/milestone[${flag}${index}]/congye_num" value="<x:out select="$milestone/congye_num" />"/>
						<input type="hidden" name="milestones/milestone[${flag}${index}]/congye_num_college" value="<x:out select="$milestone/congye_num_college" />"/>
												
						<input type="hidden" name="milestones/milestone[${flag}${index}]/qiyedengji_nature_value" value="<x:out select="$milestone/qiyedengji_nature_value" />"/>
						<input type="hidden" name="milestones/milestone[${flag}${index}]/qiyetexing_nature_value" value="<x:out select="$milestone/qiyetexing_nature_value" />"/>
						<input type="hidden" name="milestones/milestone[${flag}${index}]/enterprises_receipts" value="<x:out select="$milestone/enterprises_receipts" />"/>
						<input type="hidden" name="milestones/milestone[${flag}${index}]/patents_number" value="<x:out select="$milestone/patents_number" />"/>
						<input type="hidden" name="milestones/milestone[${flag}${index}]/invent_patents_number" value="<x:out select="$milestone/invent_patents_number" />"/>
						<input type="hidden" name="milestones/milestone[${flag}${index}]/business_scope_brief" value="<x:out select="$milestone/business_scope_brief" />"/>
						
					
						
					
						
						
					
				</td>
					<td align="center">
					<span name="milestones/milestone[${flag}${index}]@seq_no">${index+1}</span>
					</td>
					<td align="left">
						<a href="#" class="yase" onclick="psnInfoViewBy(this,'milestone_edit')"><span name="milestones/milestone[${flag}${index}]/zh_name"><x:out select="$milestone/zh_name" /></span></a>
					</td>
					
					<td align="left">
						<span name="milestones/milestone[${flag}${index}]/legal_person"><x:out select="$milestone/legal_person" /></span>
					</td>
					<td align="left">
						<span name="milestones/milestone[${flag}${index}]/contacts_mobile_hatched"><x:out select="$milestone/contacts_mobile_hatched" /></span>
					</td>
					<td align="left">
						<span name="milestones/milestone[${flag}${index}]/fax"><x:out select="$milestone/fax" /></span>
					</td>
					
					<td align="center">
						<span name="milestones/milestone[${flag}${index}]/settled_birthday"><x:out select="$milestone/settled_birthday" /></span>
					</td>
					
					<td align="left">
						<span name="milestones/milestone[${flag}${index}]/register_address"><x:out select="$milestone/register_address" /></span>
					</td>
				</tr>
				<c:set value="${index+1}" var="index" scope="page" />
			</x:forEach>
			</tbody>
	</table>
<textarea id="xmlStr" style="display: none" >${xmlstr}</textarea>
<script type="text/javascript"> 
	function psnInfoViewBy(obj,tableId,titleName) {
		var subGrantCode = $("[name='proposal/sub_grant_code']").val();
		var url;
		if(subGrantCode == 476){
			url = ctx+"/proposal/view/dialog/psnInfoEdit_kjqyfhqba?parentTab="+
					tableId+"&type=edit&needMeetingInfo=1&TB_iframe=true&height=460&width=910";
		}else{
			url = ctx+"/proposal/view/dialog/psnInfoEdit_kjqyfhqba?parentTab="+tableId+"&type=edit&TB_iframe=true&height=460&width=910";
		}
		$(obj).parents("tr").find(":radio").attr("checked",true);	
		if(!$("#"+tableId+" :radio:checked").length>0){
			scmWarn(irisNotes.pleaseSelectARow);
			return false;
		}
		if(url!=null&&url!=""){
			// showThickBox(url,irisNotes.viewResearcherInformation);
			var title=irisNotes.viewResearcherInformation;
			if (titleName != undefined)
			{
				title = titleName;
			}
			tb_show(title,url,false);
		}
		/* $("#TB_title :input").Attr("readonly",'true'); */
	}
	
	$(function(){
		//将申请书xml中的研究领域xml字符串设置到每个设备的对应隐藏域
		setEquipment("milestone_edit", "xmlStr");
		
	});
	
	function setEquipment(tblId, xmlId, nodeName){
		var xmlStr = $.trim($("#"+xmlId).val());
		//console.log(xmlStr);
		if(xmlStr==null || xmlStr==""){
			return false;
		}
		var reg = /[\r\n]/g;
		xmlStr=xmlStr.replace(reg,""); 
		var milestonesNode = /<milestones(.\n?)+?<\/milestones>/g;
		var milestones = xmlStr.match(milestonesNode);
		
		if(milestones==null || !milestones.length ||milestones.length==0){
			return;
		}
		
		var milestoneNode = /<milestone[^s](.\n?)+?<\/milestone>/g;
		var milestone = milestones[0].match(milestoneNode);
		//console.log(milestone);
		if(milestone != null){
			$("#"+tblId+" tr:gt(0)").each(function(i,obj){
				//console.log(milestone[i]);
				if(milestone[i]!=null){
					var equipments = milestone[i].match(/<equipments(.\n?)+?<\/equipments>/);
					if(equipments!=null){
						var str = equipments[0].replace(/<equipments.*?>|<\/equipments>/g,"");
						$(obj).find("[name$='/equipments']").val(str);
						
					}
				} 
				
			});
		}
	}
	
	
	


</script>
	
	
	
	